<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta http-equiv="pragma" content="no-cache">
    <!-- HTTP 1.0 -->
    <meta http-equiv="cache-control" content="no-cache">
    <!-- Prevent caching at the proxy server -->
    <meta http-equiv="expires" content="0">
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9"/>
    <title>极速收款</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/app.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/mui.min.css">
    <link rel="stylesheet" href="css/cash.css">
</head>

<body>
<div class="container-fluid">
    <div class="cash">
        <div class="mui-bar mui-bar-nav">
            <h1 class="mui-title">极速收款</h1>
            <a class="mui-action-back mui-pull-left backView"></a>
            <span class="mui-icon mui-icon-info mui-pull-right" id="vip"></span>
        </div>
        <div class="mui-content">
            <div class="mui-card-content-inner">
                <p class="welcome">
                    <span>Hi，尊敬的<span id="user-status"></span></span><br>
                    <span id="user-vip-time">您的极速收款有效期至2010-06-09</span>
                </p>
                <div>
                    <a href="javascript:;" onclick="toBankBindList()"><img src="./img/home/yhk.png"
                                                                           alt="银行卡"><span>银行卡</span></a>
                    <a href="javascript:;" onclick="toPay()"><img src="./img/home/sk.png" alt="收款"><span>收 款</span></a>
                    <a href="javascript:;" onclick="toRecord()"><img src="./img/home/jyjl.png"
                                                                     alt="交易记录"><span>交易记录</span></a>
                </div>
            </div>
            <div class="body mui-scroll-wrapper">
                <article class="mui-scroll">
                    <h1>注意：</h1>
                    <p>使用本付款服务需基于真实交易背景，严禁客户使用本公司产品作为套现等违法行为的工具，否则后果自负。</p>
                    <h1>须知：</h1>
                    <p>1.银行卡：结算卡请绑定借记卡；<br>2.收款：用户收款在验证信用卡时，先绑定信用卡，按照要求正确填写交易银行卡认证信息；认证成功的银行卡无需再提交一资料，点击“立即支付”即可使用；用户可自行管理已认证的银行卡，如选择“删除”，该卡以后交易需要重新认证；<br>3.
                        交易记录：查询收款详情，结算失败需重新发起“提现”。
                    </p>
                </article>
            </div>
        </div>

        <!--弹窗通道-->
        <div class="mask"></div>
        <div class="vipService">
            <ul>
                <li>VIP限时特惠</li>
                <!-- <li>VIP奖金提现</li> -->
            </ul>
        </div>
        <div class="vip">
            <div class="vipBanner">
            </div>
            <!-- <div class="vipInfo">
                <h1>您目前的收款金额为：</h1>
                <strong><span id="count">0元</span></strong>
                <p>须知：</p>
                <p>1.活动有效期内收款总金额达<span class="countBack"></span>元，现金奖励<span class="backMoney"></span>元(限一次)，收款金额达标后点击提现即可到默认绑定的借记卡；
                </p>
                <p>2.现金奖励活动有效期至：<span class="backEndDate"></span></p>
                <button id="vip-reward" data-loading-text=" " onclick="reward()" class="btn-brown center-block">提现
                </button>
            </div> -->
            <div class="vipOrder">
                <h1>限时特惠 VIP年卡</h1>
                <strong><span class="vipDiscount"></span>元/年&nbsp;<del class="vipMoney"></del>
                    元/年</strong>
                <p>须知：</p>
                <p><!-- 1. -->VIP年卡为服务类产品，一经售出不予退还；</p>
                <!-- <p>2.活动有效期内收款总金额达<span class="countBack"></span>元，现金奖励<span class="backMoney"></span>元(限一次)，收款金额达标后点击提现即可到默认绑定的借记卡；
                </p>
                <p>3.现金奖励活动有效期至：<span class="backEndDate"></span></p> -->
                <button onclick="pay()" class="btn-brown center-block">立即开通</button>
            </div>
            <!-- <span class="close">&times;</span> -->
            <span class="mui-icon mui-icon-closeempty close"></span>

        </div>
    </div>
</div>
<div id="picture" class="mui-popover mui-popover-action mui-popover-bottom">
    <ul class="mui-table-view" id="actionsheet">
    </ul>
    <ul class="mui-table-view">
        <li class="mui-table-view-cell">
            <a href="#picture"><b>取消</b></a>
        </li>
    </ul>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/mui.min.js"></script>
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" src="js/validateutil.js"></script>
<script>
    $(function () {
//            if(sessionStorage.getItem("payerId") == undefined){
//                mui.alert("由于VIP缴费通道维护中，已缴费用户可进行收款交易，未缴费用户请等待通道维护结束，再进行缴费。由此给您带来的不便，尽请谅解。");
//            }
        sessionStorage.setItem("ipAddress", getUrlParam("ipAddress"));
        sessionStorage.setItem("payerId", getUrlParam("payerId"));
        sessionStorage.setItem("appId", getUrlParam("appId"));
    });
</script>
<script type="text/javascript" src="js/cash.js"></script>
<script>
    mui.init();

    function backView() {
        if (window.webkit != undefined && window.webkit != null) {
            window.webkit.messageHandlers.backView.postMessage("backView");
        }
    }

    // vip缴费通道
    var vipGateway = null;
    // 返回
    mui(document.body).on('tap', '.backView', function () {
        backView();
        if (mui.os.android == true) {
            android.finishActivity();
        }
    });

    // 立即开通
    function pay() {
        if (sessionStorage.getItem('vip') == 'yes')
            mui.alert('您已经是VIP用户了。');
        else
            showVipPay();
    }

    // VIP缴费
    function vipPayment() {
        var params = {
            "payerId": sessionStorage.getItem("payerId"),
            "appId": sessionStorage.getItem("appId"),
            "orderIp": sessionStorage.getItem("ipAddress")
        };
        $.ajax({
            url: "/thmlfApi/avs/pay/createVipPayOrder",
            type: "POST",
            dataType: "JSON",
            data: JSON.stringify(params),
            contentType: "application/json",
            success: function (r) {
                if (r.code == 200) {
                    var url = r.result.url;
                    if (url.indexOf("?") == -1)
                        url = url + "?";
                    else
                        url = url + "&";
                    window.location.href = url + "payerId=" + sessionStorage.getItem("payerId") + "&" + "amount=" + r.result.amount + "&" + "orderNum=" + r.result.orderNum + "&" + "gateway=" + vipGateway;
                } else {
                    mui.alert(r.message);
                }
            },
            error: function (e) {
                mui.toast("服务器繁忙,请稍后再试");
                console.error("request error", e);
            }
        });
    }

    // 发起奖励金提现
    function reward() {
        mui.alert("请联系400-888-5115");
        return;
        mui('#vip-reward').button('loading');
        $.ajax({
            url: '/thmlfApi/avs/pay/getvipreward' + "?_d=" + Date.parse(new Date()),
            type: "POST",
            data: {
                payerId: sessionStorage.getItem("payerId"),
                orderIp: sessionStorage.getItem("orderIp"),
                appId: sessionStorage.getItem("appId")
            },
            success: function (r) {
                mui('#vip-reward').button('reset');
                if (r.code == 200) {
                    mui.alert("提现成功");
                    $('#vip-reward').attr("disabled", 'true');
                } else
                    mui.alert(r.message);
            },
            error: function (e) {
                mui('#vip-reward').button('reset');
                console.error("request error", e);
                mui.alert("网络繁忙，请稍后再试");
            }
        });
    }

    mui.ready(function () {
        var token = getUrlParam("payerId");
        var providerId = "100000" + getUrlParam("appId");
        //window.location.href = "https://akk.028wkf.cn/pay/speed/?providerId=" + providerId + "&token=" + token + "&type=quick-get";
        //return;
        // 获取用户信息
        $.ajax({
            url: "/thmlfApi/avs/pay/getuservipinfo?payerId=" + sessionStorage.getItem("payerId") + "&_d=" + Date.parse(new Date()),
            success: function (r) {
                if (r.code == 200) {
                    if (r.result.status == 1) {
                        $('#user-status').text("VIP用户");
                        $('#user-vip-time').text("您的极速收款有效期至" + r.result.endTime.substr(0, 10));
                        console.log('draw', r.result.isDraw);
                        if (r.result.isDraw == 1)
                            $('#vip-reward').attr("disabled", 'true');
                        if (CompareDate(r.result.endTime, new Date().toDateString()))
                            sessionStorage.setItem('vip', 'yes');
                        else
                            sessionStorage.setItem('vip', 'no');
                    } else {
                        $('#user-status').text("普通用户");
                        $('#user-vip-time').text("此功仅限VIP用户使用");
                        sessionStorage.setItem('vip', 'no');
                    }
                } else
                    mui.alert(r.message);
            },
            error: function (e) {
                mui.toast('服务器繁忙，请稍后再试');
            }
        });
//            $.getJSON("/thmlfApi/avs/pay/getuservipinfo?payerId=" + sessionStorage.getItem("payerId") + "&_d=" +
//                Date.parse(new Date()), null,
//                function (r) {
//
//                });
        // 获取配置信息
        $.getJSON("/thmlfApi/avs/pay/getvipconfig" + "?_d=" + Date.parse(new Date()), null, function (r) {
            if (r.code == 200) {
                vipGateway = r.result.vipAccess;
                if (CompareDate(r.result.discountEndDate, new Date().toDateString()))
                    vipMoney = r.result.vipDiscount == '0' ? r.result.vipMoney : r.result.vipDiscount;
                else
                    vipMoney = r.result.vipMoney;
                $('.vipDiscount').text(vipMoney);
                $('.vipMoney').text(r.result.vipMoney);
                $('.backMoney').text(r.result.backMoney);
                $('.backEndDate').text(r.result.backEndDate.substr(0, 10));
                $('.countBack').text(r.result.countBack);
                $('.moneyBackCount').text(r.result.countBack);
            } else
                mui.alert(r.message);
        });


        mui('.mui-scroll-wrapper').scroll({
            deceleration: 0.0005, //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
            scrollY: true, //是否竖向滚动
            scrollX: false, //是否横向滚动
            startX: 0, //初始化时滚动至x
            startY: 0, //初始化时滚动至y
            indicators: false, //是否显示滚动条
            deceleration: 0.0006, //阻尼系数,系数越小滑动越灵敏
            bounce: true //是否启用回弹
        });
        var welcome = $(".welcome > span");
        welcome.css("margin-left", ($('.welcome').width() - welcome.eq(1).width()) / 2);

        $("#vip").click(function () {
            var oVip = $(".vipService");
            oVip.slideToggle("normal", function () {
                $(".cash").on("click", function (e) {
                    if (!/^VIP/.test(e.target.innerText) && e.target.id !==
                        "vip") {
                        oVip.slideToggle();
                    }
                    $(".cash").unbind();
                })
            });
        });

        $(".vipService > ul > li").click(function (e) {
            var oMask = $(".mask"),
                oVip = $(".vip"),
                oClose = $(".vip > .close");

            var text = e.target.innerText,
                info = $(".vipInfo"),
                order = $(".vipOrder");

            switch (text) {
                case "VIP奖金提现":
                    $.getJSON("/thmlfApi/avs/pay/getpaycount?payerId=" + sessionStorage.getItem(
                        "payerId") + "&_d=" + Date.parse(new Date()), null, function (r) {
                        if (r.code == 200)
                            $('#count').text((r.result == null ? 0 : r.result) + '元');
                    });
                    info.show();
                    order.hide();
                    break;
                case "VIP限时特惠":
                    info.hide();
                    order.show();
                    break;
                default:
                    break;
            }
            $(".vipService").slideToggle();
            oVip.fadeIn();
            oMask.fadeIn();
            oMask.one("click", function () {
                oVip.fadeOut();
                oMask.fadeOut();
            });
            oClose.one("click", function () {
                oVip.fadeOut();
                oMask.fadeOut();
            });
        });
    });
</script>
</body>

</html>